from mosquitto import *
import time


def on_connect(mosq, obj, rc):
    print("Connected to MQTT broker: rc="+str(rc))

mqttc = Mosquitto()
mqttc.on_connect = on_connect
mqttc.connect("2001:ba8:1f1:f271::2%eth0")
#mqttc.connect("fe80::a00:27ff:fe31:bdc7%eth0")
mqttc.loop_start()

while (True):
	time.sleep(4)
	testData = time.time()
	mqttc.publish("cjtest/", testData, retain=True)
	print("Sending:",testData)
